﻿@using Microsoft.Web.Mvc
@using SapaFinance.DTO
@using SapaFinance.UI.Controllers
@model OrderDTO
<fieldset>
    <legend>Распоряжение</legend>
    @Html.HiddenFor(c => c.UID)
    @Html.HiddenFor(x=>x.SelectedCurrency)
    @{
        if (@Model.UID != Guid.Empty)
        {
        <div class="display-label">@Html.LabelFor(m => @Model.Number): @Html.DisplayFor(m => @Model.Number)</div>
            Html.RenderPartial("EditorTemplates/ChangableDTO", @Model);
        }
    }
    <table>
        <tr>
            <td>
                <div class="display-label">@Html.LabelFor(m => @Model.PaymentPeriod)</div>
                <div class="editor-field">@Html.EditorFor(m => @Model.PaymentPeriod)</div>
                <div class="display-label">@Html.LabelFor(m => @Model.SelectedAgent)</div>
                @{
                    if (string.IsNullOrWhiteSpace(@Model.PayerSharePie))
                    {
                        Html.RenderAction<AgentController>(x => x.RenderAgent(@Model.SelectedAgent));
                    <div class="display-label">@Html.ValidationMessageFor(x => @Model.SelectedAgent)</div>

                    }
                    else
                    {
                    <div class="display-label">@Model.AgentName</div>
                    @Html.HiddenFor(x => x.SelectedAgent)
                    }
                }
                <div class="display-label">@Html.LabelFor(m => @Model.SelectedCurrency)</div>
                <div class="display-label">@Model.CurrencyName</div>
                @* @{ Html.RenderAction<CurrencyController>(x => x.RenderCurrency(@Model.SelectedCurrency)); }*@
                <div class="display-label">@Html.LabelFor(m => @Model.Payment) @Html.ValidationMessageFor(x => x.Payment)</div>
                @{  if (@Model.UID != Guid.Empty)
                    {
                    <div class="editor-field">@Model.Payment</div>
                    @Html.HiddenFor(x=>x.Payment)
                    }
                    else
                    {
                    <div class="editor-field">@Html.EditorFor(m => @Model.Payment)</div>
                    }
                }
                <div class="display-label">@Html.LabelFor(m => @Model.PaymentPurpose)</div>
                <div class="editor-field">@Html.EditorFor(m => @Model.PaymentPurpose)</div>
            </td>
            <td>
            </td>
        </tr>
    </table>
    @Html.ValidationSummary(true)
</fieldset>
